package com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.repository;

import com.iwhalecloud.citybrain.flow.platform.manager.domain.repository.ProcessInstanceRepository;
import com.iwhalecloud.citybrain.flow.platform.manager.application.common.command.FindExecutionEntityCmd;
import org.flowable.engine.ManagementService;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author cheng.huaxing
 * @date 2019-04-01
 */
@Service
public class ProcessInstanceRepositoryImpl implements ProcessInstanceRepository {

    @Autowired
    private ManagementService managementService;

    @Override
    public ExecutionEntity findById(String executionId) {
        return managementService.executeCommand(new FindExecutionEntityCmd(executionId));
    }
}
